#ifndef CMESSAGINGLAYER_H
#define CMESSAGINGLAYER_H

#include <QObject>

#include "cauthinfo.h"
#include "contactinfo.h"
#include "cmessage.h"

class CProfile;

class CMessagingLayer : public QObject
{
    Q_OBJECT
public:
    explicit CMessagingLayer(QObject *parent = 0);
    ~CMessagingLayer();

    static CMessagingLayer * instance();

    CProfile * currentProfile() const;
    void setProfile(const CAuthInfo &authInfo);

    void sendMessage(const QString &message, const ContactInfo &to);

    ContactInfo resolveUid(const QString &uid, const QString &networkId);

signals:
    void messageReceived(const CMessage &message);

public slots:
    void connectProfile();
    void disconnectProfile();

private:
    void registerProtocols();

    CProfile * m_currentProfile;
    static CMessagingLayer * m_instance;
};

#endif // CMESSAGINGLAYER_H
